home *** CD-ROM | disk | FTP | other *** search
- /* BFD_CACHE_MAX_OPEN
- The maxiumum number of files which the cache will keep open at one
- time.
- */
- #define BFD_CACHE_MAX_OPEN 10
-
- /*
-
- bfd_last_cache
- Zero, or a pointer to the topmost BFD on the chain. This is used by
- the @code{bfd_cache_lookup} macro in @file{libbfd.h} to determine when
- it can avoid a function call.
- */
- extern bfd *bfd_last_cache;
-
- /*
-
- bfd_cache_lookup
- Checks to see if the required BFD is the same as the last one looked
- up. If so then it can use the iostream in the BFD with impunity, since
- it can't have changed since the last lookup, otherwise it has to
- perform the complicated lookup function
- */
- #define bfd_cache_lookup(x) \
- ((x)==bfd_last_cache? \
- (FILE*)(bfd_last_cache->iostream): \
- bfd_cache_lookup_worker(x))
-
- /*
-
- *i bfd_cache_init
- Initialize a BFD by putting it on the cache LRU.
- */
- PROTO(void, bfd_cache_init, (bfd *));
-
- /*
-
- *i bfd_cache_close
- Remove the BFD from the cache. If the attached file is open, then close it too.
- */
- PROTO(void, bfd_cache_close, (bfd *));
-
- /*
-
- *i bfd_open_file
- Call the OS to open a file for this BFD. Returns the FILE *
- (possibly null) that results from this operation. Sets up the
- BFD so that future accesses know the file is open. If the FILE *
- returned is null, then there is won't have been put in the cache, so
- it won't have to be removed from it.
- */
- PROTO(FILE *, bfd_open_file, (bfd *));
-
- /*
-
- *i bfd_cache_lookup_worker
- Called when the macro @code{bfd_cache_lookup} fails to find a quick
- answer. Finds a file descriptor for this BFD. If necessary, it open it.
- If there are already more than BFD_CACHE_MAX_OPEN files open, it trys to close
- one first, to avoid running out of file descriptors.
- */
- PROTO(FILE *, bfd_cache_lookup_worker, (bfd *));
-
- /*
- */
-
-